local kankan = fk.CreateSkill{
    name = "rmt__kankan"
}
Fk:loadTranslationTable{
    ["rmt__kankan"] = "看看",
    [":rmt__kankan"] = "出牌阶段限一次，你可以声明一张目标唯一的手牌的花色点数，令其他角色同时为你推荐目标，然后你使用此牌，且根据推荐该目标的角色数执行"..
    "<br>1名，其回复1点体力；<br>2名，其各摸一张牌；<br>3名及更多，其各弃置一张牌并重置此技能。",
    ["#rmt__kankan-log"] = "%from 发动了〖%arg〗，询问一张 %arg2%arg3 单目标牌的推荐目标",
    ["#rmt__kankan-prompt"] = "看看: %dest 询问你其使用一张 %arg%arg2 单目标牌的推荐目标",
    ["@[chara]rmt__kankan-phase"] = "推荐",
    ["#rmt__kankan-use"] = "看看：请选择你要使用 %arg 的目标",
}

kankan:addEffect("active", {
    can_use = function (self, player)
        return player:usedSkillTimes(kankan.name,Player.HistoryPhase) == 0
    end,
    card_num = 1,
    card_filter = function (self, player, to_select, selected, selected_targets)
        local card = Fk:getCardById(to_select)
        return not card.multiple_targets and table.contains(player.player_cards[Player.Hand], to_select) and not table.contains({"jink","nullification"},card.trueName)
    end,
    target_num = 0,
    target_filter = Util.FalseFunc,
    on_use = function (self, room, effect)
        local player = effect.from
        local card = Fk:getCardById(effect.cards[1])
        local suit = card:getSuitString(true)
        local number = card:getNumberStr(card.number)
        room:sendLog{
            type = "#rmt__kankan-log",
            from = player.id,
            arg = kankan.name,
            arg2 = suit,
            arg3 = number,
            toast = true,
        }
        room:doIndicate(player.id, table.map(room.alive_players, Util.IdMapper))
        local targets = room:getOtherPlayers(player)
        local req = Request:new(room:getOtherPlayers(player), "AskForUseActiveSkill")
        req.focus_text = kankan.name
        local extraData = {
            targets = table.map(room.alive_players, Util.IdMapper),
            num = 1,
            min_num = 1,
            pattern = "",
            skillName = kankan.name,
        }
        local data = { "choose_players_skill", "#rmt__kankan-prompt::"..player.id..":"..suit..":"..number, false, extraData, false }
        for _, p in ipairs(room:getOtherPlayers(player)) do
            req:setData(p, data)
            req:setDefaultReply(p, {targets = {table.random(table.map(room.alive_players, Util.IdMapper))}})
        end
        req:ask()
        for _, cp in ipairs(room:getOtherPlayers(player)) do
            local to
            if type(req:getResult(cp)) == "table" then
                to = req:getResult(cp).targets[1]
            else
                to = table.random(table.map(targets, Util.IdMapper))
            end
            room:doIndicate(cp.id,{to})
            room:setPlayerMark(cp,"@[chara]rmt__kankan-phase",to)
        end

        local trueTarget = room:askToChoosePlayers(player, {
            targets = room.alive_players,
            max_num = 1,
            min_num = 1,
            skill_name = kankan.name,
            prompt = "#rmt__kankan-use:::"..card:toLogString()
        })
        local use = {
            card = card,
            from = player,
            tos = trueTarget,
            extraUse = true,
        }
        room:useCard(use)

        local num = #table.filter(room.alive_players,function (cp)
            return cp:getMark("@[chara]rmt__kankan-phase") == trueTarget[1].id
        end)
        for _, cp in ipairs(room.alive_players) do
            if cp:getMark("@[chara]rmt__kankan-phase") == trueTarget[1].id then
                if num == 1 and cp:isWounded() then
                    room:recover({who = cp,num = 1,recoverBy = player,skillName = kankan.name})
                end
                if num == 2 then
                    cp:drawCards(1,kankan.name)
                end
                if num >= 3 and not cp:isNude() then
                    room:askToDiscard(cp, {
                        max_num = 1,
                        min_num = 1,
                        include_equip = true,
                        skill_name = kankan.name,
                        cancelable = false,
                    })
                    player:setSkillUseHistory(kankan.name,0,Player.HistoryPhase)
                end
            end
        end
        for _, cp in ipairs(room.alive_players) do
            room:setPlayerMark(cp,"@[chara]rmt__kankan-phase",0)
        end
    end,
})

return kankan